package chances.system.operator.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "CS_SYS_OPERATOR_LOG")
public class Oplog {
    public static final int OPER_SUCCESS = 0;
    public static final int OPER_ERROR = 1;

    public static final String OBJ_TYPE_OPERATOR = "operator";// 操作员
    public static final String OBJ_TYPE_ROLE = "role";// 角色
    public static final String OBJ_TYPE_ORGANIZATION = "organization";// 组织
    public static final String OBJ_TYPE_MGMTINFO = "mgmtinfo";// 网站配置
    public static final String OBJ_TYPE_FOLDER = "folder";
    public static final String OBJ_TYPE_PROVIDER = "provider";
    public static final String OBJ_TYPE_APP = "app";
    public static final String OBJ_TYPE_TYPE = "type";//分类
    public static final String OBJ_TYPE_APP_BLACK = "appBlack";
    public static final String OBJ_TYPE_APP_STORE = "appStore";
    public static final String OBJ_TYPE_TAG = "tag";
    public static final String OBJ_TYPE_BIZ = "biz";
    public static final String OBJ_TYPE_BIZ_POSITION = "bizPosition";
    public static final String OBJ_TYPE_TEMPLATE_PACKAGE = "templatePackage";
    public static final String OBJ_TYPE_TEMPLATE = "template";
    public static final String OBJ_TYPE_TEMPLATE_PARAMDEF = "templateParamdef";
    public static final String OBJ_TYPE_TEMPLATE_PARAMINST = "templateParamInst";
    public static final String OBJ_TYPE_TEMPLATE_BIND = "templateBind";
    public static final String OBJ_TYPE_CPCONTENT = "cpcontent";
    public static final String OBJ_TYPE_UNITCONTENT = "unitContent";

    public static final String OP_ADD = "add";// 新增
    public static final String OP_EDIT = "edit";// 修改
    public static final String OP_DELETE = "delete";// 删除
    public static final String OP_DISABLE = "disable";// 失效
    public static final String OP_ENABLE = "enable";// 生效
    public static final String OP_PUBLISH = "publish";// 发布
    public static final String OP_OFFLINE = "offline";// 下线
    public static final String OP_EXPORT = "export";// 导出
    public static final String OP_LOGIN = "login";// 登陆
    public static final String OP_LOGOUT = "logout";// 注销
    public static final String OP_AUDIT = "audit";// 审核
    public static final String OP_ADOPT = "adopt";//采纳
    public static final String OP_FILL = "fill";//填充
    public static final String OP_DECLARE = "declare";//申报
    public static final String OP_ONLINE = "online";//内容上线
    
    public static final String OP_CANCELAOPT = "cancelAopt"; //取消采纳
    public static final String OP_EXCLUSIVE = "exclusive"; //确认独家
    public static final String OP_CANCELEXCLUSIVE = "cancelExclusive"; //取消独家
    public static final String OP_MERGER = "merger"; //内容归并
    public static final String OP_AWAY = "away"; //内容脱离
    
    

    @Id
    @Column(name = "ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "DESCRIPTION", length = 1024)
    private String desc;// 描述信息

    @Column(name = "PARAMETER", length = 1024)
    private String formParameters;// 保存表单内的信息（供开发人员查看）

    @Column(name = "OBJ_TYPE", length = 64)
    private String objType;// 对象类型 操作员，角色

    @Column(name = "OP_TYPE")
    private String operateType; // 操作类型 新增 修改 删除

    @Column(name = "OP_NAME")
    private String opName;

    @Column(name = "OP_RESULT")
    private Integer operateResult; // 操作结果

    @Column(name = "OP_TIME")
    private Date operateTime;// 操作时间

    @Column(name = "OP_MODEL")
    private String model;
    
    @Column(name = "OBJ_ID")
    private Long objId;

    public Oplog() {

    }

    public Oplog(Operator operator, String operateType, String objType, String model,
            Integer operateResult, String desc) {
        if (operator != null) {
            this.opName = operator.getName();
        }
        this.operateType = operateType;
        this.objType = objType;
        this.model = model;
        this.desc = desc;
        this.operateResult = operateResult;
        this.operateTime = new Date();
    }

    public Long getObjId() {
        return objId;
    }

    public void setObjId(Long objId) {
        this.objId = objId;
    }

    public String getOpName() {
        return opName;
    }

    public void setOpName(String opName) {
        this.opName = opName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getFormParameters() {
        return formParameters;
    }

    public void setFormParameters(String formParameters) {
        this.formParameters = formParameters;
    }

    public String getObjType() {
        return objType;
    }

    public void setObjType(String objType) {
        this.objType = objType;
    }

    public String getOperateType() {
        return operateType;
    }

    public void setOperateType(String operateType) {
        this.operateType = operateType;
    }

    public Integer getOperateResult() {
        return operateResult;
    }

    public void setOperateResult(Integer operateResult) {
        this.operateResult = operateResult;
    }

    public Date getOperateTime() {
        return operateTime;
    }

    public void setOperateTime(Date operateTime) {
        this.operateTime = operateTime;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

}
